package logic;

import java.io.Serializable;

/**
 * the server and client communicate by sending this Message object that contains the message details
 * @author raz
 *
 */
public class Message implements Serializable {
	/**
	 * the wanted action to be performed
	 */
	private String command;
	/**
	 * an object that is sent according to action (can be Reader,Book...) 
	 */
	private Object objects;
	/**
	 * Used in search book,the search types are : subject ,bookname,author, free
	 */
	private String  searchType;
	/**
	 * Used in search book , contains the search content which the user filled
	 */
	private String  searchContent;
	
	/**
	 * default constructor
	 */
	public Message(){
	
	command=null;
	objects =null;
	searchType=null;
	searchContent=null;
	}
	/**
	 * most common constructor  , contains a string message(command) and an object to be sent form server to client and vice versa
	 * @param command message from server to client and vice versa
	 * @param objects an object to be sent
	 */
public Message(String command,Object objects){
	this.command=command ;
	this.objects =objects ;
	searchType=null;
	searchContent=null;
}
/**
 * constructor used in search action
 * @param command search command
 * @param objects
 * @param searchType  the search types are : subject ,bookname,author, free
 * @param searchContent contains the search content which the user filled
 */
public Message(String command,Object objects,String searchType,String searchContent){
	this.command=command ;
	this.objects =objects ;
	this.searchType=searchType;
	this.searchContent=searchContent;
}


	public String getCommand() {
		return command;
	}
	public void setCommand(String command) {
		this.command = command;
	}
	public void setObjects(Object objects) {
		this.objects = objects;
	}
	public Object getObjects() {
		return objects;
	}
	public String getSearchType() {
		return searchType;
	}
	public void setSearchType(String searchType) {
		this.searchType=searchType;
	}
	public String getSearchContent() {
		return searchContent;
	}
	public void setSetsearchContent(String searchContent) {
		this.searchContent=searchContent;
	}
	public String toString() {
		return super.toString();
	}

}
